<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>Fast Develop Designer</title>

    <link rel="stylesheet" href="./compoment/amis/sdk.css" />
    <link rel="stylesheet" href="./compoment/amis/iconfont.css" />
    <link rel="stylesheet" href="./compoment/@ztree/ztree_v3/css/demo.css">
    <link rel="stylesheet" href="./compoment/@ztree/ztree_v3/css/zTreeStyle/zTreeStyle.css">
    <link rel="stylesheet" href="./compoment/layui/dist/css/layui.css">
    <!--jQuery dependencies-->
    <link rel="stylesheet" href="./compoment/jquery-ui/jquery-ui.css" />
    <script src="./compoment/jquery/jquery.min.js"></script>
    <!-- <script src="./compoment/jquery/jquery-1.4.4.min.js"></script> -->
    <script src="./compoment/jquery-ui/jquery-ui.min.js"></script>
    <!--PQ Grid files-->
    <link rel="stylesheet" href="./compoment/jqgrid/pqgrid.min.css" />
    <script src="./compoment/jqgrid/pqgrid.min.js"></script>
    <!--PQ Grid Office theme-->

    <link rel="stylesheet" href="./compoment/jqgrid/themes/bootstrap/pqgrid.css" />
    <link rel="stylesheet" href="./css/all.min.css">

</head>
<!--<body>-->

<body class="">

    <div id="app" class="layui-layout layui-layout-admin content" />
    <script src="./compoment/amis/sdk.js"></script>

    <script src="./compoment/layui/dist/layui.js"></script>
    <!-- <script type="text/javascript" src="./compoment/@ztree/ztree_v3/js/jquery-1.4.4.min.js"></script> -->
    <script type="text/javascript" src="./compoment/@ztree/ztree_v3/js/jquery.ztree.core.js"></script>
    <script type="text/javascript" src="./compoment/@ztree/ztree_v3/js/jquery.ztree.extend.js"></script>
    <script type="text/javascript" src="./compoment/ajax-hook/dist/ajaxhook.min.js"></script>

    <script src="./js/fastDevelop.js"></script>

    <script id="domainModelForm" type="text/html">
        <form class="layui-form" action="" style="display: block;" id="form-data" lay-filter="data-form">
            <div class="layui-form-item">
                <label class="layui-form-label">Name</label>
                <div class="layui-input-block">
                    <input type="text" lay-ignore name="name" lay-verify="name" autocomplete="off" placeholder=""
                        required class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">Table</label>
                <div class="layui-input-block">
                    <input type="text" lay-ignore name="tableName" lay-verify="tableName" autocomplete="off"
                        placeholder="" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">Description</label>
                <div class="layui-input-block">
                    <textarea name="comment" lay-ignore placeholder="" class="layui-textarea"></textarea>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button type="submit" lay-ignore class="layui-btn layui-btn-sm layui-btn-normal" lay-submit=""
                        lay-filter="*">Save</button>
                </div>
            </div>
        </form>
    </script>

    <script id="domainModelFieldForm" type="text/html">
        <form class="layui-form" action="" style="display: block;" id="form-data" lay-filter="data-form">
            <div class="layui-form-item">
                <label class="layui-form-label">Name</label>
                <div class="layui-input-block">
                    {{#  if(d.type.metaType === 'domain_file_field_primary_key'){ }}
                    <input type="text" name="name" lay-ignore lay-verify="name" readonly autocomplete="off"
                        placeholder="" required class="layui-input">

                    {{#  }else{ }}
                    <input type="text" name="name" lay-ignore lay-verify="name" autocomplete="off" placeholder=""
                        required class="layui-input">
                    {{#  } }}

                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">Type</label>
                <div class="layui-input-block">
                    <div class="layui-input-inline" style="width: 100px;">
                        {{#  if(d.type.metaType === 'domain_file_field_primary_key'){ }}
                        <select name="catalog" lay-verify="" disabled>
                            <option value="basic">Basic</option>
                        </select>

                        {{#  }else{ }}
                        <select name="catalog" lay-verify="">
                            <option value="basic">Basic</option>
                        </select>
                        {{#  } }}


                    </div>
                    <div class="layui-input-inline" style="width: 160px; margin-right: 0px;">
                        {{#  if(d.type.metaType === 'domain_file_field_primary_key'){ }}
                        <select name="type" lay-verify="" disabled>
                            <option value="string">String</option>
                            <option value="integer">Integer</option>
                            <option value="double">Double</option>
                            <option value="date">Date</option>
                            <!--<option value="Image">Image</option>-->
                            <option value="text">Text</option>
                            <!--<option value="File">File</option>-->
                        </select>

                        {{#  }else{ }}
                        <select name="type" lay-verify="">
                            <option value="string">String</option>
                            <option value="integer">Integer</option>
                            <option value="double">Double</option>
                            <option value="date">Date</option>
                            <!--<option value="Image">Image</option>-->
                            <option value="text">Text</option>
                            <!--<option value="File">File</option>-->
                        </select>
                        {{#  } }}

                    </div>
                </div>

            </div>



            <div class="layui-form-item">
                <label class="layui-form-label">Length</label>
                <div class="layui-input-block">
                    {{#  if(d.type.metaType === 'domain_file_field_primary_key'){ }}
                    <input type="text" name="length" lay-ignore lay-verify="number" readonly autocomplete="off"
                        placeholder="" class="layui-input">

                    {{#  }else{ }}
                    <input type="text" name="length" lay-ignore lay-verify="number" autocomplete="off" placeholder=""
                        class="layui-input">
                    {{#  } }}

                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">Column</label>
                <div class="layui-input-block">
                    <input type="text" name="columnName" lay-ignore lay-verify="columnName" autocomplete="off"
                        placeholder="" class="layui-input">
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label">Description</label>
                <div class="layui-input-block">
                    <textarea name="comment" lay-ignore placeholder="" class="layui-textarea"></textarea>
                </div>
            </div>


            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button type="submit" class="layui-btn layui-btn-sm layui-btn-normal" lay-submit=""
                        lay-filter="*">Save</button>
                </div>
            </div>

        </form>
    </script>


    <script>
        var envPath = "/platform",
            appId = "f41ee9217ee84289b550f077aa695eff";
        rootApi = "/platform"

        //gs文件, 田赛builder使用
        // var envPath="/builder",appId="default";
        // rootApi="/builder"


        layui.use(['editor', 'amis', 'ztree', 'fast_config', 'app', 'utils', 'drag'], function () {
            console.log(layui.config())

            let editor = layui.editor,
                amis = layui.amis,
                ztree = layui.ztree,
                utils = layui.utils,
                fast_config = layui.fast_config,
                app = layui.app;

            utils.setGlobalEnv(appId);
            let conf_str = utils.stringformat(JSON.stringify(fast_config), utils.getGlobalEnv());
            fast_config = JSON.parse(conf_str);

            app.render({
                elem: '#app',
                //该字段为tenantId
                version: '3.0.3',
                id: appId,
                //该字段内可增加额外要增加的header全局字段
                ajaxHeaderParams: {},

                contentSettings: {
                    editorSettings: {
                        isResponsive: true,
                        resource_trees_settings: [{
                                elem: "#resource",
                                contentElem: '#fast-body',
                                enableRootPath: true,
                                api: fast_config.moudle.tree.main.url,
                                viewMode: 'tabs',
                                icon: 'resource',
                                title: '资源管理',
                                schemaType: fast_config.moudle.tree.main.schemaType,
                                onClickListener: function (event, treeId, treeNode) {
                                    if (treeNode.data.type.value !== 'moudle') {
                                        $('#run').attr("disabled", true);
                                    } else {
                                        $('#run').removeAttr("disabled");
                                    }
                                }
                            },
                            {
                                elem: "#workflowResource",
                                contentElem: '#fast-body',
                                enableRootPath: true,
                                api: fast_config.moudle.tree.second.url,
                                viewMode: 'tabs',
                                icon: 'workflow',
                                title: '流程对象',
                                schemaType: fast_config.moudle.tree.second.schemaType,
                                onClickListener: function (event, treeId, treeNode) {
                                    $('#run').attr("disabled", true);
                                }
                            },
                            {
                                elem: "#sysResource",
                                contentElem: '#fast-body',
                                enableRootPath: true,
                                api: fast_config.moudle.tree.system.url,
                                viewMode: 'tabs',
                                icon: 'system',
                                title: '系统配置',
                                schemaType: fast_config.moudle.tree.system.schemaType,
                                onClickListener: function (event, treeId, treeNode) {
                                    $('#run').attr("disabled", true);
                                }
                            },
                            {
                                elem: "#brmsResource",
                                contentElem: '#fast-body',
                                enableRootPath: true,
                                api: fast_config.moudle.tree.brms.url,
                                viewMode: 'tabs',
                                icon: 'brms',
                                title: '规则对象',
                                schemaType: fast_config.moudle.tree.brms.schemaType,
                                onClickListener: function (event, treeId, treeNode) {
                                    $('#run').attr("disabled", true);
                                }
                            }
                        ],
                        enav_setting: {
                            elem: '#header-left',
                            data: []
                        }
                    }
                },
                headerSettings: {
                    resourceToolbarSettings: {
                        previewApi: fast_config.app.previewApi + `?tenantId=${appId}&appName=示例应用`,
                        logoutApi: fast_config.app.logoutApi,
                        vuePreviewApi: fast_config.app.vuePreviewApi + `?tenantId=${appId}/`,
                        userName: "zhangsan",
                    },
                    publishSettings: {
                        api: fast_config.moudle.publishApi,
                        callback: {
                            ready: function (elem, buttonId) {
                                $('#' + buttonId).attr("disabled", true);
                            }
                        }
                    }
                }
            })
        })
    </script>

</body>

</html>